"""
数据库访问工厂（单例模式）
遵循开发规范，提供Repository实例
"""
from repositories.orm_face_repository import ORMFaceRepository


class DatabaseFactory:
    """数据库访问工厂（单例模式）"""

    _instances = {}

    @classmethod
    def get_face_repository(cls) -> ORMFaceRepository:
        """获取人脸Repository"""
        if 'face' not in cls._instances:
            cls._instances['face'] = ORMFaceRepository()
        return cls._instances['face']


# 全局工厂实例
database_factory = DatabaseFactory()
